package com.yupi.cli.command;

import picocli.CommandLine;

@CommandLine.Command(name = "yuzi", mixinStandardHelpOptions = true)
public class CommandExecutor implements Runnable {
    private final CommandLine commandLine;

    {//初始化作用域
        commandLine = new CommandLine(this)
                .addSubcommand(new ConfigCommand())
                .addSubcommand(new GenerateCommand())
                .addSubcommand(new ListCommand());
    }

    @Override
    public void run() {
        //不输入子命令时，给出友好提示
        System.out.println("请输入具体命令，或输入-help查看");
    }

    //执行命令
    public Integer doExecute(String[] args) {
        return commandLine.execute(args);
    }
}
